using System.Collections.Generic;

namespace ActiveRecordSample.Entities
{
	// Business class ProductCategory generated from ProductCategory
	// shvadskd [2008-10-20] Created

	using System;
	using System.ComponentModel;
	using Castle.ActiveRecord;

   [ActiveRecord("SalesLT.ProductCategory")]
	public  class ProductCategory 
		: ActiveRecordValidationBase<ProductCategory> 
	{

		#region Property_Names

		public static string Prop_ProductCategoryID = "ProductCategoryID";
		public static string Prop_ParentProductCategory = "ParentProductCategory";
		public static string Prop_Name = "Name";
		public static string Prop_rowguid = "rowguid";
		public static string Prop_ModifiedDate = "ModifiedDate";

		#endregion

		#region Private_Variables

		private int _productcategoryid;
		private ProductCategory _parentProductCategory;
		private string _name;	
		private DateTime _modifiedDate;

		private IList<Product> _Product = new List<Product>();		

		#endregion

		#region Constructors

		public ProductCategory()
		{
		}

		public ProductCategory(
			int p_productcategoryid,
			ProductCategory p_parentProductCategory,
			string p_name,
			byte[] p_rowguid,
			DateTime p_modifiedDate)
		{
			_productcategoryid = p_productcategoryid;
			_parentProductCategory = p_parentProductCategory;
			_name = p_name;			
			_modifiedDate = p_modifiedDate;
		}

		#endregion

		#region Properties

		[PrimaryKey("ProductCategoryID", Access = PropertyAccess.NosetterLowercaseUnderscore)]
		public int ProductCategoryID
		{
			get { return _productcategoryid; }
		}

		[BelongsTo("ParentProductCategoryID", Type = typeof(ProductCategory))]
		public ProductCategory ParentProductCategory
		{
			get { return _parentProductCategory; }
			set { _parentProductCategory = value; }
		}

		[Property("Name", NotNull = true, Length = 50)]
		public string Name
		{
			get { return _name; }
			set { _name = value; }
		}
      

		[Property("ModifiedDate", NotNull = true)]
		public DateTime ModifiedDate
		{
			get { return _modifiedDate; }
			set { _modifiedDate = value; }
		}

	[HasMany(typeof(Product), Table="Product", ColumnKey="ProductCategoryID")]
	public IList<Product> Product
	{
	    get { return _Product; }
	    set { _Product = value; }
	}
	
		#endregion

	} // ProductCategory
}

